{% set pypi_name = 'os-resource-classes' %}
{% set upstream_version = upstream_version('1.0.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Resource Classes for OpenStack
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
A list of standardized resource classes for OpenStack.
A resource class is a distinct type of inventory that exists in a cloud
environment, for example VCPU, DISK_GB. They are upper case with underscores.
They often include a unit in their name.
This package provides a collection of symbols representing those standard
resource classes which are expected to be available in any OpenStack deployment.
There also exists a concept of custom resource classes. These are countable
types that are custom to a particular environment. The OpenStack placement
API provides a way to create these. A custom resource class always begins
with a CUSTOM_ prefix.

%package -n {{ py2name(py_versions='py3') }}
Summary:        Resource Classes for OpenStack
Requires:       {{ py3('pbr') }}

%description -n {{ py2name(py_versions='py3') }}
A list of standardized resource classes for OpenStack.
A resource class is a distinct type of inventory that exists in a cloud
environment, for example VCPU, DISK_GB. They are upper case with underscores.
They often include a unit in their name.
This package provides a collection of symbols representing those standard
resource classes which are expected to be available in any OpenStack deployment.
There also exists a concept of custom resource classes. These are countable
types that are custom to a particular environment. The OpenStack placement
API provides a way to create these. A custom resource class always begins
with a CUSTOM_ prefix.

This package contains the Python 3.x module

%package -n python-os-resource-classes-doc
Summary:        Documentation for Resource Classes for OpenStack
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n python-os-resource-classes-doc
A list of standardized resource classes for OpenStack.
A resource class is a distinct type of inventory that exists in a cloud
environment, for example VCPU, DISK_GB. They are upper case with underscores.
They often include a unit in their name.
This package provides a collection of symbols representing those standard
resource classes which are expected to be available in any OpenStack deployment.
There also exists a concept of custom resource classes. These are countable
types that are custom to a particular environment. The OpenStack placement
API provides a way to create these. A custom resource class always begins
with a CUSTOM_ prefix.

This package contains the documentation.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%doc README.rst ChangeLog
%license LICENSE
%{python3_sitelib}/os_resource_classes*
%{python3_sitelib}/*.egg-info

%files -n python-os-resource-classes-doc
%doc doc/build/html
%license LICENSE

%changelog
